#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10000;
bool not_P[MAXN];
int prime[MAXN], p_cnt;
int p_list[MAXN], l_cnt;
char c[][6] = {"01-10", "02-20", "03-30", "10-01", "11-11", "12-21"};
void Init() {
    p_cnt = 0;
    for (int i=2; i<MAXN; ++i) {
        if (!not_P[i]) {
            prime[p_cnt++] = i;
        }
        for (int j=0; j<p_cnt&&prime[j]*i<MAXN; ++j) {
            not_P[i*prime[j]] = true;
            if (i%prime[j] == 0) {
                break;
            }
        }
    }
    l_cnt = 0;
    for (int i=0; i<p_cnt; ++i) {
        if (prime[i]>=2000 && prime[i]<10000) p_list[l_cnt++] = prime[i];
    }
}


int main() {
    Init();
    int ask, t;
    scanf("%d", &t);
    while (t--) {
        scanf("%d", &ask);
        --ask;
        int p = ask/6;
        int m = ask%6;
        printf("%d-%s\n", p_list[p], c[m]);
    }
    return 0;
}
